package cn.xiaoyuan.controller.page;

import cn.xiaoyuan.entity.AuthUser;
import cn.xiaoyuan.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttribute;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/page/user")
public class UserPageController {
    @Resource
    UserService userService;
    @RequestMapping("/orders")
    public String orders(HttpSession session, Model model){
        AuthUser user= (AuthUser) session.getAttribute("user");
        model.addAttribute("userOrderList",userService.getSellByUser(user.getId()));
        return "user/orders";
    }
    @RequestMapping("/addProduct")
    public String addProduct(){
        return "user/addProduct";
    }
}
